package com.lzx.adx.report.controller.v1.vivo;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.lzs.adx.commmon.utils.JsonUtils;
import com.lzs.adx.commmon.utils.Result;
import com.lzx.adx.report.bean.mapper.ReportMapper;
import com.lzx.adx.report.cache.AccountLocalCache;
import com.lzx.adx.report.dto.AccountDTO;
import com.lzx.adx.report.dto.ReportDTO;
import com.lzx.adx.report.dto.ViVoData;
import com.lzx.adx.report.enums.ViVoElemCovertEnum;
import com.lzx.adx.report.model.vivo.ViVoRequest;
import com.lzx.adx.report.service.ReportService;
import com.lzx.adx.report.util.UrlUtil;
import com.lzx.adx.report.util.helper.VivoHelper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RequestMapping("/vivo")
@RestController
@Slf4j
public class VivoAuthController {


    @Autowired
    private ReportService reportService;

    @Autowired
    private ThreadPoolTaskExecutor reportExecutor;

    @Autowired
    private ReportMapper reportMapper;






    @GetMapping("/auth")
    public ResponseEntity report(String state,String code){
        log.info("接收到请求参数state{},code{}",state, code);
        String clientId="20231221009";
        String secret="08C1480E964B3FABC53210975E2BD6048C5F8BAF56CD193677C91FAC67F60FB0";

        String url="https://marketing-api.vivo.com.cn/openapi/v1/oauth2/token?client_id="+clientId+"&client_secret="+secret+"&grant_type=code&code="+code;

        String s = HttpUtil.get(url);

        return  ResponseEntity.ok(s);
    }








}
